//
//  3DChooseViewController.m
//  myDemo2
//
//  Created by wuxueying on 5/12/14.
//
//

#import "3DChooseViewController.h"
#import "ZYQSphereView.h"

@interface _DChooseViewController () {
    ZYQSphereView *sphereView;
}
@end
@implementation _DChooseViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blackColor];
	sphereView = [[ZYQSphereView alloc] initWithFrame:CGRectMake(10, 60, 300, 300)];
    sphereView.center=CGPointMake(self.view.center.x, self.view.center.y-30);
	NSMutableArray *views = [[NSMutableArray alloc] init];
	for (int i = 0; i < 50; i++) {
		UIButton *subV = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
		subV.backgroundColor = [UIColor colorWithRed:arc4random_uniform(100)/100. green:arc4random_uniform(100)/100. blue:arc4random_uniform(100)/100. alpha:1];
        [subV setTitle:[NSString stringWithFormat:@"%d",i] forState:UIControlStateNormal];
        subV.layer.masksToBounds=YES;
        subV.layer.cornerRadius=3;
        [subV addTarget:self action:@selector(subVClick:) forControlEvents:UIControlEventTouchUpInside];
        [views addObject:subV];
	}
	[sphereView setItems:views];
	[self.view addSubview:sphereView];
}

-(void)subVClick:(UIButton*)sender{
    NSLog(@"%@",sender.titleLabel.text);
}

@end
